{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2207c56f-11b3-4f07-b815-1ab66c3d8b23",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Py3_Jupyter_Nb_Pandas(股票同比分析)_GF_2024-01-16.ipynb\n",
    "# Create By GF 2024-01-16 12:09"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "b2874876",
   "metadata": {},
   "outputs": [],
   "source": [
    "import zhdate # -> ZhDate Version 0.1\n",
    "import datetime\n",
    "import pandas as pd # -> Pandas Version 1.4.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b4345811",
   "metadata": {},
   "outputs": [],
   "source": [
    "def MapFunc_DateTime_Judgement_Leap_Year(DateTime:object) -> str:\n",
    "    \n",
    "    \"\"\"\n",
    "    [Require] import datetime\n",
    "    \n",
    "    [Explain] * Divide the number of Gregorian years by 4, and if you get an integer, then this year is a leap year.\n",
    "                公历年数除以 4, 如果得到的是整数, 那这一年就是闰年。\n",
    "              \n",
    "              * If the number of years in the Gregorian calendar is a multiple of 100 and then divided by 400, the result is an integer, which is also a leap year.\n",
    "                公历年数是 100 的整数倍, 再除以 400, 得到的是整数, 那这一年也是闰年。\n",
    "              \n",
    "              * For example, dividing 2020 by 4 can result in an integer division, which means 2020 is a leap year.\n",
    "                例如: 2020年 除以 4 可以整除, 即 2020 年为闰年。\n",
    "    \"\"\"\n",
    "    Year:int = 0\n",
    "    \n",
    "    # ----------------------------------------------\n",
    "    if (type(DateTime) is datetime.datetime): Year = DateTime.year\n",
    "    # ..............................................\n",
    "    if (type(DateTime) is str): Year = int(DateTime[0:4])\n",
    "    \n",
    "    # ----------------------------------------------\n",
    "    # Non whole hundred year judgment method:\n",
    "    if   (Year % 4   == 0):\n",
    "        \n",
    "        return str(\"闰年\") # -> 闰年 (Leap Year)\n",
    "    \n",
    "    # whole hundred year judgment method:\n",
    "    elif (Year % 100 == 0) and (Year % 400 == 0):\n",
    "        \n",
    "        return str(\"闰年\") # -> 闰年 (Leap Year)\n",
    "    \n",
    "    else:\n",
    "        \n",
    "        return str(\"平年\") # -> 闰年 (Common Year)\n",
    "    # ##############################################\n",
    "    # End of Function."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5ce7f534",
   "metadata": {},
   "outputs": [],
   "source": [
    "StkPDF = pd.read_csv(\"./Datas/Stock.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "308c64fd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Date</th>\n",
       "      <th>Code</th>\n",
       "      <th>Open</th>\n",
       "      <th>High</th>\n",
       "      <th>Low</th>\n",
       "      <th>Close</th>\n",
       "      <th>Pre_Close</th>\n",
       "      <th>Change</th>\n",
       "      <th>Chg_Pct</th>\n",
       "      <th>Turnover</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Amount</th>\n",
       "      <th>Circle</th>\n",
       "      <th>Total</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2015-12-31</td>\n",
       "      <td>'000422</td>\n",
       "      <td>7.93</td>\n",
       "      <td>7.95</td>\n",
       "      <td>7.76</td>\n",
       "      <td>7.77</td>\n",
       "      <td>7.93</td>\n",
       "      <td>-0.16</td>\n",
       "      <td>-0.020177</td>\n",
       "      <td>0.015498</td>\n",
       "      <td>13915200</td>\n",
       "      <td>109318000</td>\n",
       "      <td>6976420000</td>\n",
       "      <td>6976420000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2015-12-30</td>\n",
       "      <td>'000422</td>\n",
       "      <td>7.86</td>\n",
       "      <td>7.93</td>\n",
       "      <td>7.75</td>\n",
       "      <td>7.93</td>\n",
       "      <td>7.84</td>\n",
       "      <td>0.09</td>\n",
       "      <td>0.011480</td>\n",
       "      <td>0.018662</td>\n",
       "      <td>16755900</td>\n",
       "      <td>131567000</td>\n",
       "      <td>7120080000</td>\n",
       "      <td>7120080000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2015-12-29</td>\n",
       "      <td>'000422</td>\n",
       "      <td>7.72</td>\n",
       "      <td>7.85</td>\n",
       "      <td>7.69</td>\n",
       "      <td>7.84</td>\n",
       "      <td>7.71</td>\n",
       "      <td>0.13</td>\n",
       "      <td>0.016861</td>\n",
       "      <td>0.015886</td>\n",
       "      <td>14263800</td>\n",
       "      <td>110789000</td>\n",
       "      <td>7039280000</td>\n",
       "      <td>7039280000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2015-12-28</td>\n",
       "      <td>'000422</td>\n",
       "      <td>8.03</td>\n",
       "      <td>8.08</td>\n",
       "      <td>7.70</td>\n",
       "      <td>7.71</td>\n",
       "      <td>8.03</td>\n",
       "      <td>-0.32</td>\n",
       "      <td>-0.039851</td>\n",
       "      <td>0.030821</td>\n",
       "      <td>27672800</td>\n",
       "      <td>218869000</td>\n",
       "      <td>6922550000</td>\n",
       "      <td>6922550000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2015-12-25</td>\n",
       "      <td>'000422</td>\n",
       "      <td>8.03</td>\n",
       "      <td>8.05</td>\n",
       "      <td>7.93</td>\n",
       "      <td>8.03</td>\n",
       "      <td>7.99</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.005006</td>\n",
       "      <td>0.021132</td>\n",
       "      <td>18974000</td>\n",
       "      <td>151673000</td>\n",
       "      <td>7209870000</td>\n",
       "      <td>7209870000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2647</th>\n",
       "      <td>2005-02-04</td>\n",
       "      <td>'000422</td>\n",
       "      <td>6.75</td>\n",
       "      <td>7.05</td>\n",
       "      <td>6.71</td>\n",
       "      <td>7.00</td>\n",
       "      <td>6.75</td>\n",
       "      <td>0.25</td>\n",
       "      <td>0.037037</td>\n",
       "      <td>0.017178</td>\n",
       "      <td>2430800</td>\n",
       "      <td>16818500</td>\n",
       "      <td>1725750000</td>\n",
       "      <td>990538000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2648</th>\n",
       "      <td>2005-02-03</td>\n",
       "      <td>'000422</td>\n",
       "      <td>7.00</td>\n",
       "      <td>7.15</td>\n",
       "      <td>6.73</td>\n",
       "      <td>6.75</td>\n",
       "      <td>6.90</td>\n",
       "      <td>-0.15</td>\n",
       "      <td>-0.021739</td>\n",
       "      <td>0.028556</td>\n",
       "      <td>4040880</td>\n",
       "      <td>28086200</td>\n",
       "      <td>1664110000</td>\n",
       "      <td>955162000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2649</th>\n",
       "      <td>2005-02-02</td>\n",
       "      <td>'000422</td>\n",
       "      <td>6.42</td>\n",
       "      <td>6.99</td>\n",
       "      <td>6.42</td>\n",
       "      <td>6.90</td>\n",
       "      <td>6.42</td>\n",
       "      <td>0.48</td>\n",
       "      <td>0.074766</td>\n",
       "      <td>0.032928</td>\n",
       "      <td>4659550</td>\n",
       "      <td>31345900</td>\n",
       "      <td>1701090000</td>\n",
       "      <td>976388000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2650</th>\n",
       "      <td>2005-02-01</td>\n",
       "      <td>'000422</td>\n",
       "      <td>6.78</td>\n",
       "      <td>6.89</td>\n",
       "      <td>6.30</td>\n",
       "      <td>6.42</td>\n",
       "      <td>6.81</td>\n",
       "      <td>-0.39</td>\n",
       "      <td>-0.057269</td>\n",
       "      <td>0.027348</td>\n",
       "      <td>3869880</td>\n",
       "      <td>25333700</td>\n",
       "      <td>1582760000</td>\n",
       "      <td>908465000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2651</th>\n",
       "      <td>2005-01-31</td>\n",
       "      <td>'000422</td>\n",
       "      <td>6.78</td>\n",
       "      <td>6.87</td>\n",
       "      <td>6.70</td>\n",
       "      <td>6.81</td>\n",
       "      <td>6.94</td>\n",
       "      <td>-0.13</td>\n",
       "      <td>-0.018732</td>\n",
       "      <td>0.018862</td>\n",
       "      <td>2669130</td>\n",
       "      <td>18135800</td>\n",
       "      <td>1678910000</td>\n",
       "      <td>963652000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2652 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           Date     Code  Open  High   Low  Close  Pre_Close  Change  \\\n",
       "0    2015-12-31  '000422  7.93  7.95  7.76   7.77       7.93   -0.16   \n",
       "1    2015-12-30  '000422  7.86  7.93  7.75   7.93       7.84    0.09   \n",
       "2    2015-12-29  '000422  7.72  7.85  7.69   7.84       7.71    0.13   \n",
       "3    2015-12-28  '000422  8.03  8.08  7.70   7.71       8.03   -0.32   \n",
       "4    2015-12-25  '000422  8.03  8.05  7.93   8.03       7.99    0.04   \n",
       "...         ...      ...   ...   ...   ...    ...        ...     ...   \n",
       "2647 2005-02-04  '000422  6.75  7.05  6.71   7.00       6.75    0.25   \n",
       "2648 2005-02-03  '000422  7.00  7.15  6.73   6.75       6.90   -0.15   \n",
       "2649 2005-02-02  '000422  6.42  6.99  6.42   6.90       6.42    0.48   \n",
       "2650 2005-02-01  '000422  6.78  6.89  6.30   6.42       6.81   -0.39   \n",
       "2651 2005-01-31  '000422  6.78  6.87  6.70   6.81       6.94   -0.13   \n",
       "\n",
       "       Chg_Pct  Turnover    Volume     Amount      Circle       Total  \n",
       "0    -0.020177  0.015498  13915200  109318000  6976420000  6976420000  \n",
       "1     0.011480  0.018662  16755900  131567000  7120080000  7120080000  \n",
       "2     0.016861  0.015886  14263800  110789000  7039280000  7039280000  \n",
       "3    -0.039851  0.030821  27672800  218869000  6922550000  6922550000  \n",
       "4     0.005006  0.021132  18974000  151673000  7209870000  7209870000  \n",
       "...        ...       ...       ...        ...         ...         ...  \n",
       "2647  0.037037  0.017178   2430800   16818500  1725750000   990538000  \n",
       "2648 -0.021739  0.028556   4040880   28086200  1664110000   955162000  \n",
       "2649  0.074766  0.032928   4659550   31345900  1701090000   976388000  \n",
       "2650 -0.057269  0.027348   3869880   25333700  1582760000   908465000  \n",
       "2651 -0.018732  0.018862   2669130   18135800  1678910000   963652000  \n",
       "\n",
       "[2652 rows x 14 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 转换类型: 初次读取后转换。\n",
    "# ##################################################\n",
    "StkPDF[\"Date\"] = StkPDF[\"Date\"].astype(\"datetime64[ns]\")\n",
    "\n",
    "# ##################################################\n",
    "StkPDF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "404a85e7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Year_Month</th>\n",
       "      <th>Change</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2005-01</td>\n",
       "      <td>-0.13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2005-02</td>\n",
       "      <td>0.52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2005-03</td>\n",
       "      <td>-0.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2005-04</td>\n",
       "      <td>0.62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2005-05</td>\n",
       "      <td>-1.23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>2015-08</td>\n",
       "      <td>-0.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>128</th>\n",
       "      <td>2015-09</td>\n",
       "      <td>-0.55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>129</th>\n",
       "      <td>2015-10</td>\n",
       "      <td>1.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>2015-11</td>\n",
       "      <td>0.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>131</th>\n",
       "      <td>2015-12</td>\n",
       "      <td>0.44</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>132 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    Year_Month  Change\n",
       "0      2005-01   -0.13\n",
       "1      2005-02    0.52\n",
       "2      2005-03   -0.29\n",
       "3      2005-04    0.62\n",
       "4      2005-05   -1.23\n",
       "..         ...     ...\n",
       "127    2015-08   -0.88\n",
       "128    2015-09   -0.55\n",
       "129    2015-10    1.00\n",
       "130    2015-11    0.07\n",
       "131    2015-12    0.44\n",
       "\n",
       "[132 rows x 2 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 聚合数据: 按公历年月聚合涨跌额。\n",
    "# ##################################################\n",
    "SourceDataPDF = StkPDF\n",
    "\n",
    "# 提取数据: 提取公历年月。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = SourceDataPDF\n",
    "# ..................................................\n",
    "TEMPPDF[\"Year_Month\"] = TEMPPDF[\"Date\"].apply(lambda X: \"%02d-%02d\" % (X.year, X.month))\n",
    "# ..................................................\n",
    "StkYearMonthPDF = TEMPPDF\n",
    "\n",
    "# 聚合数据: 按公历年月聚合涨跌额。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = StkYearMonthPDF[[\"Year_Month\", \"Change\"]]\n",
    "# ..................................................\n",
    "TEMPPDF = TEMPPDF.groupby(\"Year_Month\", as_index=False).sum(\"Change\")\n",
    "# ..................................................\n",
    "StkYearMonthPDF = TEMPPDF\n",
    "\n",
    "# ##################################################\n",
    "StkYearMonthPDF.sort_values(\"Year_Month\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "5cfad848",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Year_Month</th>\n",
       "      <th>Change</th>\n",
       "      <th>Pre1_Year_Month</th>\n",
       "      <th>Pre1_Change</th>\n",
       "      <th>Pre2_Year_Month</th>\n",
       "      <th>Pre2_Change</th>\n",
       "      <th>Pre3_Year_Month</th>\n",
       "      <th>Pre3_Change</th>\n",
       "      <th>YOY_Features</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>131</th>\n",
       "      <td>2015-12</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2014-12</td>\n",
       "      <td>0.87</td>\n",
       "      <td>2013-12</td>\n",
       "      <td>-0.43</td>\n",
       "      <td>2012-12</td>\n",
       "      <td>2.08</td>\n",
       "      <td>1,0,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>2015-11</td>\n",
       "      <td>0.07</td>\n",
       "      <td>2014-11</td>\n",
       "      <td>0.49</td>\n",
       "      <td>2013-11</td>\n",
       "      <td>0.22</td>\n",
       "      <td>2012-11</td>\n",
       "      <td>-1.56</td>\n",
       "      <td>1,1,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>129</th>\n",
       "      <td>2015-10</td>\n",
       "      <td>1.00</td>\n",
       "      <td>2014-10</td>\n",
       "      <td>-0.14</td>\n",
       "      <td>2013-10</td>\n",
       "      <td>-0.46</td>\n",
       "      <td>2012-10</td>\n",
       "      <td>-1.55</td>\n",
       "      <td>0,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>128</th>\n",
       "      <td>2015-09</td>\n",
       "      <td>-0.55</td>\n",
       "      <td>2014-09</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2013-09</td>\n",
       "      <td>-0.04</td>\n",
       "      <td>2012-09</td>\n",
       "      <td>0.38</td>\n",
       "      <td>1,0,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>2015-08</td>\n",
       "      <td>-0.88</td>\n",
       "      <td>2014-08</td>\n",
       "      <td>0.25</td>\n",
       "      <td>2013-08</td>\n",
       "      <td>0.59</td>\n",
       "      <td>2012-08</td>\n",
       "      <td>-0.54</td>\n",
       "      <td>1,1,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126</th>\n",
       "      <td>2015-07</td>\n",
       "      <td>-1.53</td>\n",
       "      <td>2014-07</td>\n",
       "      <td>0.48</td>\n",
       "      <td>2013-07</td>\n",
       "      <td>-0.26</td>\n",
       "      <td>2012-07</td>\n",
       "      <td>0.05</td>\n",
       "      <td>1,0,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125</th>\n",
       "      <td>2015-06</td>\n",
       "      <td>-0.27</td>\n",
       "      <td>2014-06</td>\n",
       "      <td>-0.05</td>\n",
       "      <td>2013-06</td>\n",
       "      <td>-2.56</td>\n",
       "      <td>2012-06</td>\n",
       "      <td>-2.05</td>\n",
       "      <td>0,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>124</th>\n",
       "      <td>2015-05</td>\n",
       "      <td>0.61</td>\n",
       "      <td>2014-05</td>\n",
       "      <td>0.11</td>\n",
       "      <td>2013-05</td>\n",
       "      <td>0.60</td>\n",
       "      <td>2012-05</td>\n",
       "      <td>0.54</td>\n",
       "      <td>1,1,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>123</th>\n",
       "      <td>2015-04</td>\n",
       "      <td>0.57</td>\n",
       "      <td>2014-04</td>\n",
       "      <td>-0.23</td>\n",
       "      <td>2013-04</td>\n",
       "      <td>-1.59</td>\n",
       "      <td>2012-04</td>\n",
       "      <td>1.70</td>\n",
       "      <td>0,0,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>122</th>\n",
       "      <td>2015-03</td>\n",
       "      <td>0.96</td>\n",
       "      <td>2014-03</td>\n",
       "      <td>-0.39</td>\n",
       "      <td>2013-03</td>\n",
       "      <td>-1.79</td>\n",
       "      <td>2012-03</td>\n",
       "      <td>-1.29</td>\n",
       "      <td>0,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>121</th>\n",
       "      <td>2015-02</td>\n",
       "      <td>0.29</td>\n",
       "      <td>2014-02</td>\n",
       "      <td>-0.09</td>\n",
       "      <td>2013-02</td>\n",
       "      <td>0.58</td>\n",
       "      <td>2012-02</td>\n",
       "      <td>0.75</td>\n",
       "      <td>0,1,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>120</th>\n",
       "      <td>2015-01</td>\n",
       "      <td>-0.42</td>\n",
       "      <td>2014-01</td>\n",
       "      <td>-0.61</td>\n",
       "      <td>2013-01</td>\n",
       "      <td>0.40</td>\n",
       "      <td>2012-01</td>\n",
       "      <td>1.18</td>\n",
       "      <td>0,1,1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Year_Month  Change Pre1_Year_Month  Pre1_Change Pre2_Year_Month  \\\n",
       "131    2015-12    0.44         2014-12         0.87         2013-12   \n",
       "130    2015-11    0.07         2014-11         0.49         2013-11   \n",
       "129    2015-10    1.00         2014-10        -0.14         2013-10   \n",
       "128    2015-09   -0.55         2014-09         0.54         2013-09   \n",
       "127    2015-08   -0.88         2014-08         0.25         2013-08   \n",
       "126    2015-07   -1.53         2014-07         0.48         2013-07   \n",
       "125    2015-06   -0.27         2014-06        -0.05         2013-06   \n",
       "124    2015-05    0.61         2014-05         0.11         2013-05   \n",
       "123    2015-04    0.57         2014-04        -0.23         2013-04   \n",
       "122    2015-03    0.96         2014-03        -0.39         2013-03   \n",
       "121    2015-02    0.29         2014-02        -0.09         2013-02   \n",
       "120    2015-01   -0.42         2014-01        -0.61         2013-01   \n",
       "\n",
       "     Pre2_Change Pre3_Year_Month  Pre3_Change YOY_Features  \n",
       "131        -0.43         2012-12         2.08        1,0,1  \n",
       "130         0.22         2012-11        -1.56        1,1,0  \n",
       "129        -0.46         2012-10        -1.55        0,0,0  \n",
       "128        -0.04         2012-09         0.38        1,0,1  \n",
       "127         0.59         2012-08        -0.54        1,1,0  \n",
       "126        -0.26         2012-07         0.05        1,0,1  \n",
       "125        -2.56         2012-06        -2.05        0,0,0  \n",
       "124         0.60         2012-05         0.54        1,1,1  \n",
       "123        -1.59         2012-04         1.70        0,0,1  \n",
       "122        -1.79         2012-03        -1.29        0,0,0  \n",
       "121         0.58         2012-02         0.75        0,1,1  \n",
       "120         0.40         2012-01         1.18        0,1,1  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 计算数据: 按公历年月提取同比(YOY)数据。\n",
    "# ##################################################\n",
    "SourceDataPDF = StkYearMonthPDF.sort_values(\"Year_Month\", ascending=False)\n",
    "\n",
    "# 提取数据: 提取公历N年前数据。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = SourceDataPDF\n",
    "# ..................................................\n",
    "TEMPPDF[\"Pre1_Year_Month\"] = TEMPPDF[\"Year_Month\"].shift(-12)\n",
    "TEMPPDF[\"Pre1_Change\"]     = TEMPPDF[\"Change\"].shift(-12)\n",
    "# ..................................................\n",
    "TEMPPDF[\"Pre2_Year_Month\"] = TEMPPDF[\"Year_Month\"].shift(-24)\n",
    "TEMPPDF[\"Pre2_Change\"]     = TEMPPDF[\"Change\"].shift(-24)\n",
    "# ..................................................\n",
    "TEMPPDF[\"Pre3_Year_Month\"] = TEMPPDF[\"Year_Month\"].shift(-36)\n",
    "TEMPPDF[\"Pre3_Change\"]     = TEMPPDF[\"Change\"].shift(-36)\n",
    "# ..................................................\n",
    "StkYearMonthYoyPDF = TEMPPDF\n",
    "\n",
    "# 提取特征: 提取公历年月同比涨跌特征。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = StkYearMonthYoyPDF\n",
    "# ..................................................\n",
    "for Idx in TEMPPDF.index:\n",
    "    Pre1_Chg = TEMPPDF.loc[Idx, \"Pre1_Change\"]\n",
    "    Pre2_Chg = TEMPPDF.loc[Idx, \"Pre2_Change\"]\n",
    "    Pre3_Chg = TEMPPDF.loc[Idx, \"Pre3_Change\"]\n",
    "    # ..............................................\n",
    "    if Pre1_Chg >= 0:\n",
    "        Pre1_Feature = str(\"1\")\n",
    "    else:\n",
    "        Pre1_Feature = str(\"0\")\n",
    "    # ..............................................\n",
    "    if Pre2_Chg >= 0:\n",
    "        Pre2_Feature = str(\"1\")\n",
    "    else:\n",
    "        Pre2_Feature = str(\"0\")\n",
    "    # ..............................................\n",
    "    if Pre3_Chg >= 0:\n",
    "        Pre3_Feature = str(\"1\")\n",
    "    else:\n",
    "        Pre3_Feature = str(\"0\")\n",
    "    # ..............................................\n",
    "    TEMPPDF.loc[Idx, \"YOY_Features\"] = \"%s,%s,%s\" % (Pre1_Feature, Pre2_Feature, Pre3_Feature)\n",
    "# ..................................................\n",
    "StkYearMonthYoyPDF = TEMPPDF\n",
    "\n",
    "# ##################################################\n",
    "StkYearMonthYoyPDF.head(12)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "3bac1790",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Zh_Year_Month</th>\n",
       "      <th>Change</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2004-12</td>\n",
       "      <td>0.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2005-01</td>\n",
       "      <td>0.62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2005-02</td>\n",
       "      <td>0.08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2005-03</td>\n",
       "      <td>-0.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2005-04</td>\n",
       "      <td>-1.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>2015-07</td>\n",
       "      <td>-1.57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>128</th>\n",
       "      <td>2015-08</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>129</th>\n",
       "      <td>2015-09</td>\n",
       "      <td>0.73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>2015-10</td>\n",
       "      <td>0.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>131</th>\n",
       "      <td>2015-11</td>\n",
       "      <td>0.10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>132 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    Zh_Year_Month  Change\n",
       "0         2004-12    0.06\n",
       "1         2005-01    0.62\n",
       "2         2005-02    0.08\n",
       "3         2005-03   -0.04\n",
       "4         2005-04   -1.61\n",
       "..            ...     ...\n",
       "127       2015-07   -1.57\n",
       "128       2015-08    0.01\n",
       "129       2015-09    0.73\n",
       "130       2015-10    0.06\n",
       "131       2015-11    0.10\n",
       "\n",
       "[132 rows x 2 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 聚合数据: 按农历年月聚合涨跌额。\n",
    "# ##################################################\n",
    "SourceDataPDF = StkPDF\n",
    "\n",
    "# 提取数据: 提取农历日期。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = SourceDataPDF\n",
    "# ..................................................\n",
    "TEMPPDF[\"Zh_Date\"] = TEMPPDF[\"Date\"].apply(lambda X: zhdate.ZhDate.from_datetime(X))\n",
    "# ..................................................\n",
    "StkZhYearMonthPDF = TEMPPDF\n",
    "\n",
    "# 提取数据: 判断农历闰月。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = SourceDataPDF\n",
    "# ..................................................\n",
    "TEMPPDF[\"Leap_Month\"] = TEMPPDF[\"Zh_Date\"].map(lambda X: \"闰月\" if (X.leap_month == True) else \"非闰月\")\n",
    "# ..................................................\n",
    "StkZhYearMonthPDF = TEMPPDF\n",
    "\n",
    "# 提取数据: 筛选出农历 [非闰月] 数据。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = SourceDataPDF\n",
    "# ..................................................\n",
    "TEMPPDF = TEMPPDF[TEMPPDF[\"Leap_Month\"] == \"非闰月\"]\n",
    "# ..................................................\n",
    "StkZhYearMonthPDF = TEMPPDF\n",
    "\n",
    "# 提取数据: 提取农历年月。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = SourceDataPDF\n",
    "# ..................................................\n",
    "TEMPPDF[\"Zh_Year_Month\"] = TEMPPDF[\"Zh_Date\"].apply(lambda X: \"%02d-%02d\" % (X.lunar_year, X.lunar_month))\n",
    "# ..................................................\n",
    "StkZhYearMonthPDF = TEMPPDF\n",
    "\n",
    "# 聚合数据: 按公历年月聚合涨跌额。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = StkZhYearMonthPDF[[\"Zh_Year_Month\", \"Change\"]]\n",
    "# ..................................................\n",
    "TEMPPDF = TEMPPDF.groupby(\"Zh_Year_Month\", as_index=False).sum(\"Change\")\n",
    "# ..................................................\n",
    "StkZhYearMonthPDF = TEMPPDF\n",
    "\n",
    "# ##################################################\n",
    "StkZhYearMonthPDF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d48f9641",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Zh_Year_Month</th>\n",
       "      <th>Change</th>\n",
       "      <th>Pre1_Zh_Year_Month</th>\n",
       "      <th>Pre1_Change</th>\n",
       "      <th>Pre2_Zh_Year_Month</th>\n",
       "      <th>Pre2_Change</th>\n",
       "      <th>Pre3_Zh_Year_Month</th>\n",
       "      <th>Pre3_Change</th>\n",
       "      <th>Zh_YOY_Features</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>131</th>\n",
       "      <td>2015-11</td>\n",
       "      <td>0.10</td>\n",
       "      <td>2014-11</td>\n",
       "      <td>-0.58</td>\n",
       "      <td>2013-11</td>\n",
       "      <td>-0.16</td>\n",
       "      <td>2012-11</td>\n",
       "      <td>0.74</td>\n",
       "      <td>0,0,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>2015-10</td>\n",
       "      <td>0.06</td>\n",
       "      <td>2014-10</td>\n",
       "      <td>0.97</td>\n",
       "      <td>2013-10</td>\n",
       "      <td>-0.11</td>\n",
       "      <td>2012-10</td>\n",
       "      <td>0.40</td>\n",
       "      <td>1,0,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>129</th>\n",
       "      <td>2015-09</td>\n",
       "      <td>0.73</td>\n",
       "      <td>2014-09</td>\n",
       "      <td>0.27</td>\n",
       "      <td>2013-09</td>\n",
       "      <td>-0.40</td>\n",
       "      <td>2012-09</td>\n",
       "      <td>-2.76</td>\n",
       "      <td>1,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>128</th>\n",
       "      <td>2015-08</td>\n",
       "      <td>0.01</td>\n",
       "      <td>2014-08</td>\n",
       "      <td>0.21</td>\n",
       "      <td>2013-08</td>\n",
       "      <td>-0.20</td>\n",
       "      <td>2012-08</td>\n",
       "      <td>-0.22</td>\n",
       "      <td>1,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>2015-07</td>\n",
       "      <td>-1.57</td>\n",
       "      <td>2014-07</td>\n",
       "      <td>0.50</td>\n",
       "      <td>2013-07</td>\n",
       "      <td>0.25</td>\n",
       "      <td>2012-07</td>\n",
       "      <td>0.12</td>\n",
       "      <td>1,1,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126</th>\n",
       "      <td>2015-06</td>\n",
       "      <td>1.11</td>\n",
       "      <td>2014-06</td>\n",
       "      <td>0.41</td>\n",
       "      <td>2013-06</td>\n",
       "      <td>-0.09</td>\n",
       "      <td>2012-06</td>\n",
       "      <td>-0.22</td>\n",
       "      <td>1,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125</th>\n",
       "      <td>2015-05</td>\n",
       "      <td>-4.99</td>\n",
       "      <td>2014-05</td>\n",
       "      <td>-0.18</td>\n",
       "      <td>2013-05</td>\n",
       "      <td>-1.51</td>\n",
       "      <td>2012-05</td>\n",
       "      <td>-0.61</td>\n",
       "      <td>0,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>124</th>\n",
       "      <td>2015-04</td>\n",
       "      <td>3.81</td>\n",
       "      <td>2014-04</td>\n",
       "      <td>0.24</td>\n",
       "      <td>2013-04</td>\n",
       "      <td>-0.27</td>\n",
       "      <td>2012-04</td>\n",
       "      <td>-0.08</td>\n",
       "      <td>1,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>123</th>\n",
       "      <td>2015-03</td>\n",
       "      <td>-0.23</td>\n",
       "      <td>2014-03</td>\n",
       "      <td>-0.37</td>\n",
       "      <td>2013-03</td>\n",
       "      <td>-1.66</td>\n",
       "      <td>2012-03</td>\n",
       "      <td>-0.65</td>\n",
       "      <td>0,0,0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>122</th>\n",
       "      <td>2015-02</td>\n",
       "      <td>0.80</td>\n",
       "      <td>2014-02</td>\n",
       "      <td>-0.30</td>\n",
       "      <td>2013-02</td>\n",
       "      <td>-0.68</td>\n",
       "      <td>2012-02</td>\n",
       "      <td>0.87</td>\n",
       "      <td>0,0,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>121</th>\n",
       "      <td>2015-01</td>\n",
       "      <td>0.71</td>\n",
       "      <td>2014-01</td>\n",
       "      <td>-0.09</td>\n",
       "      <td>2013-01</td>\n",
       "      <td>-1.16</td>\n",
       "      <td>2012-01</td>\n",
       "      <td>0.45</td>\n",
       "      <td>0,0,1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>120</th>\n",
       "      <td>2014-12</td>\n",
       "      <td>0.51</td>\n",
       "      <td>2013-12</td>\n",
       "      <td>-0.61</td>\n",
       "      <td>2012-12</td>\n",
       "      <td>1.52</td>\n",
       "      <td>2011-12</td>\n",
       "      <td>1.32</td>\n",
       "      <td>0,1,1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Zh_Year_Month  Change Pre1_Zh_Year_Month  Pre1_Change Pre2_Zh_Year_Month  \\\n",
       "131       2015-11    0.10            2014-11        -0.58            2013-11   \n",
       "130       2015-10    0.06            2014-10         0.97            2013-10   \n",
       "129       2015-09    0.73            2014-09         0.27            2013-09   \n",
       "128       2015-08    0.01            2014-08         0.21            2013-08   \n",
       "127       2015-07   -1.57            2014-07         0.50            2013-07   \n",
       "126       2015-06    1.11            2014-06         0.41            2013-06   \n",
       "125       2015-05   -4.99            2014-05        -0.18            2013-05   \n",
       "124       2015-04    3.81            2014-04         0.24            2013-04   \n",
       "123       2015-03   -0.23            2014-03        -0.37            2013-03   \n",
       "122       2015-02    0.80            2014-02        -0.30            2013-02   \n",
       "121       2015-01    0.71            2014-01        -0.09            2013-01   \n",
       "120       2014-12    0.51            2013-12        -0.61            2012-12   \n",
       "\n",
       "     Pre2_Change Pre3_Zh_Year_Month  Pre3_Change Zh_YOY_Features  \n",
       "131        -0.16            2012-11         0.74           0,0,1  \n",
       "130        -0.11            2012-10         0.40           1,0,1  \n",
       "129        -0.40            2012-09        -2.76           1,0,0  \n",
       "128        -0.20            2012-08        -0.22           1,0,0  \n",
       "127         0.25            2012-07         0.12           1,1,1  \n",
       "126        -0.09            2012-06        -0.22           1,0,0  \n",
       "125        -1.51            2012-05        -0.61           0,0,0  \n",
       "124        -0.27            2012-04        -0.08           1,0,0  \n",
       "123        -1.66            2012-03        -0.65           0,0,0  \n",
       "122        -0.68            2012-02         0.87           0,0,1  \n",
       "121        -1.16            2012-01         0.45           0,0,1  \n",
       "120         1.52            2011-12         1.32           0,1,1  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 计算数据: 按农历年月提取同比(YOY)数据。\n",
    "# ##################################################\n",
    "SourceDataPDF = StkZhYearMonthPDF.sort_values(\"Zh_Year_Month\", ascending=False)\n",
    "\n",
    "# 提取数据: 提取公历N年前数据。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = SourceDataPDF\n",
    "# ..................................................\n",
    "TEMPPDF[\"Pre1_Zh_Year_Month\"] = TEMPPDF[\"Zh_Year_Month\"].shift(-12)\n",
    "TEMPPDF[\"Pre1_Change\"]        = TEMPPDF[\"Change\"].shift(-12)\n",
    "# ..................................................\n",
    "TEMPPDF[\"Pre2_Zh_Year_Month\"] = TEMPPDF[\"Zh_Year_Month\"].shift(-24)\n",
    "TEMPPDF[\"Pre2_Change\"]        = TEMPPDF[\"Change\"].shift(-24)\n",
    "# ..................................................\n",
    "TEMPPDF[\"Pre3_Zh_Year_Month\"] = TEMPPDF[\"Zh_Year_Month\"].shift(-36)\n",
    "TEMPPDF[\"Pre3_Change\"]        = TEMPPDF[\"Change\"].shift(-36)\n",
    "# ..................................................\n",
    "StkZhYearMonthYoyPDF = TEMPPDF\n",
    "\n",
    "# 提取特征: 提取农历年月同比涨跌特征。\n",
    "# --------------------------------------------------\n",
    "TEMPPDF = StkZhYearMonthYoyPDF\n",
    "# ..................................................\n",
    "for Idx in TEMPPDF.index:\n",
    "    Pre1_Chg = TEMPPDF.loc[Idx, \"Pre1_Change\"]\n",
    "    Pre2_Chg = TEMPPDF.loc[Idx, \"Pre2_Change\"]\n",
    "    Pre3_Chg = TEMPPDF.loc[Idx, \"Pre3_Change\"]\n",
    "    # ..............................................\n",
    "    if Pre1_Chg >= 0:\n",
    "        Pre1_Feature = str(\"1\")\n",
    "    else:\n",
    "        Pre1_Feature = str(\"0\")\n",
    "    # ..............................................\n",
    "    if Pre2_Chg >= 0:\n",
    "        Pre2_Feature = str(\"1\")\n",
    "    else:\n",
    "        Pre2_Feature = str(\"0\")\n",
    "    # ..............................................\n",
    "    if Pre3_Chg >= 0:\n",
    "        Pre3_Feature = str(\"1\")\n",
    "    else:\n",
    "        Pre3_Feature = str(\"0\")\n",
    "    # ..............................................\n",
    "    TEMPPDF.loc[Idx, \"Zh_YOY_Features\"] = \"%s,%s,%s\" % (Pre1_Feature, Pre2_Feature, Pre3_Feature)\n",
    "# ..................................................\n",
    "StkZhYearMonthYoyPDF = TEMPPDF\n",
    "\n",
    "# ##################################################\n",
    "StkZhYearMonthYoyPDF.head(12)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5c27dd2e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
